<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<div class="t_bar">
	<span class="color_red">*</span>项目建设阶段、目标及资金使用计划
	<span style="font-size: 12px;font-weight: normal;">
		（总投入资金，包括已完成投资及新增投资）
	</span>
</div>
	<table  id="milestone_edit" border="0" cellspacing="0" cellpadding="0" class="table01" >
		<thead>
			<tr>
                
                <th nowrap width="50px" >序号</th>
				<th width="200px">建设阶段</th>
				<th width="100px">人员费</th>
				<th width="100px">仪器设备费</th>
				<th width="100px">外协费用</th>
				<th width="100px">其他费用</th>
				<th width="100px" nowrap="nowrap">小计</th>
				<th width="100px" nowrap="nowrap">查看</th>
				
			</tr>
		</thead>
		<tbody id="tab">
			
			<x:forEach select="$xmlData/data/milestones/milestone" var="milestone">
				
				<tr>
					<td align="center">
					    <input type="radio" name="sel_zh_persons" onclick="setSubmitPsn()" style="display:none"/> 
						<input type="hidden" name="milestones/milestone[${flag}${index}]/content" value="<x:out select="$milestone/content" />" />
						<input type="hidden" name="milestones/milestone[${flag}${index}]/content_hidden" value="<x:out select="$milestone/content_hidden" />" />
						<input type="hidden" name="milestones/milestone[${flag}${index}]/equipments" value="" label="xml"/>
						<span name="milestones/milestone[${flag}${index}]@seq_no"><x:out select="$milestone/@seq_no"/></span>
					</td>
					<td align="center">
						<span name="milestones/milestone[${flag}${index}]/start_date"><x:out select="$milestone/start_date" /></span> 至  <span name="milestones/milestone[${flag}${index}]/end_date"><x:out select="$milestone/end_date" /></span>
					</td>
					<td>
						<span name="milestones/milestone[${flag}${index}]/personnel_costs"><x:out select="$milestone/personnel_costs" /></span>万元
					</td>
					<td>
						<span name="milestones/milestone[${flag}${index}]/equipment/equipments/equipment_total_costs"><x:out select="$milestone/equipment/equipments/equipment_total_costs" /></span>万元
					</td>
					<td>
						<span name="milestones/milestone[${flag}${index}]/outsourcing_costs"><x:out select="$milestone/outsourcing_costs" /></span>万元
					</td>
					<td>
						<span name="milestones/milestone[${flag}${index}]/other_costs"><x:out select="$milestone/other_costs" /></span>万元
					</td>
					<td>
						<span name="milestones/milestone[${flag}${index}]/total_costs"><x:out select="$milestone/total_costs" /></span>万元
					</td>
					<td align='center'><a href="#" class="yase" onclick="psnInfoViewByYbyf1(this,'milestone_edit')">查看</a></td>
				</tr>
			</x:forEach>
			</tbody>
	</table>
<br>

<textarea id="xmlStr" style="display: none" >${param.xmlstr}</textarea>
	
<script type="text/javascript">
showAllDateTag("milestone_edit");
$(function(){
	
	//将申请书xml中的研究领域xml字符串设置到每个设备的对应隐藏域
	setEquipment("milestone_edit", "xmlStr");

});


function setEquipment(tblId, xmlId, nodeName){
	var xmlStr = $.trim($("#"+xmlId).val());
	
	if(xmlStr==null || xmlStr=="")
		return false;
	var reg = /[\r\n]/g;
	xmlStr=xmlStr.replace(reg,""); 
	var milestonesNode = /<milestones(.\n?)+?<\/milestones>/g;
	var milestones = xmlStr.match(milestonesNode);
	if(milestones==null || !milestones.length ||milestones.length==0)return;
	var milestoneNode = /<milestone[^s](.\n?)+?<\/milestone>/g;
	var milestone = milestones[0].match(milestoneNode);
	
	if(milestone != null){
		$("#"+tblId+" tr:gt(0)").each(function(i,obj){
			if(milestone[i]!=null){
				var equipments = milestone[i].match(/<equipments(.\n?)+?<\/equipments>/);
				
				
				if(equipments!=null){
					var str = equipments[0].replace(/<equipments.*?>|<\/equipments>/g,"");
					
					$(obj).find("[name$='/equipments']").val(str);
					
				}
			} 
			
		});
	}
}
	
</script>
<script type="text/javascript">
function psnInfoViewByYbyf1(obj,tableId) {
	$(obj).parents("tr").find(":radio").attr("checked",true);	
	
	if(!$("#"+tableId+" :radio:checked").length>0){
		scmWarn(irisNotes.pleaseSelectARow);
		return false;
	}
	editRow('milestone_edit','${ctx}/proposal/view/dialog/prpMilestonesInfoEdit_cxzj?parentTab=milestone_edit&type=edit&needMeetingInfo=${param.needMeetingInfo}&TB_iframe=true&height=350&width=680','编辑项目计划信息')
	
}
</script>